The present invention relates to a computer and is suitably used for, for example, a computer that outputs trace data based on execution of a program.
A multiprogramming environment means an environment in which a plurality of programs is, so to speak, executed in parallel by periodically switching the programs or switching a program to be executed in response to an occurrence of an event. The multiprogramming may also be referred to as multiprocess, multithread, multitask, and the like. A process, a thread, and a task mean a processing unit that is executed in parallel in the multiprogramming environment. Although these terms are often mixed up and used, generally, the process is a parallel processing unit to which a program execution environment such as a memory space is independently assigned and which is highly independent from other processes. On the other hand, the thread is a smaller parallel processing unit included in a process that is processed in parallel. In a multithread environment, a process includes a plurality of threads. Each thread can access a resource assigned to the process, and a plurality of threads in the same process shares a memory space. The thread and the process may be referred to as a task.
In order to support debug of a program executed in the multiprogramming environment, there is known a tool which displays a chart showing executions of functions, threads, or processes and transitions of these, as shown in FIG. 1. In the example of FIG. 1, time transition of tasks (that is, threads or processes) is visually displayed. Meanwhile, the function is a packaged program module including an instruction sequence for performing specific processing. The term of “function” used in the present specification means a concept including a function in a strict sense that returns a return value and a procedure that does not return a return value, according to C and C++ that are typical of structured programming languages. The term of “function” used in the present specification can be referred to as a subroutine, a subprogram, or a method.
In order to grasp the transition of function, thread, or process, in compiling which generates assembly code from source code, a code called a marker instruction or a check point instruction is inserted in the assembly code. The marker instruction or the check point instruction is different from arithmetic instructions and load/store instructions for performing original processing described in the source code and is a debug instruction defined to trace an execution of a program. The marker instruction or the checkpoint instruction is executed on a computer configured to output trace data based on execution of a program.
For example, Japanese Patent Laid-Open No. 1998-78889 (Patent Literature 1) discloses a computer including a CPU (Central Processing Unit) and a monitor unit. In Patent Literature 1, the CPU (Central Processing Unit) supplies a marker decoding signal (a pulse signal) to the monitor unit in order to activate the monitor unit in response to decoding of the marker instruction. In addition, in response to reception of the marker decoding signal, the monitor unit acquires an address of the marker instruction (a program counter value) and a value of an accumulator, and outputs trace data including an identifier indicating the marker instruction (for example, an identifier such as “M”), the address of the marker instruction, and the value of the accumulator.